package org.simpleframework.singleton;
public class LazySingletonDemo {
    private static LazySingletonDemo instance = null;
    private LazySingletonDemo(){}

    // 改造前：线程不安全，存在返回多个实例的隐患
    /*public static LazySingletonDemo getInstance(){
        if(instance == null){
            instance = new LazySingletonDemo();
        }
        return instance;
    }*/


    public static synchronized LazySingletonDemo getInstance(){
        if(instance == null){
            instance = new LazySingletonDemo();
        }
        return instance;
    }
}
